package com.zwh.rabbitmq.module.project.web;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zwh.rabbitmq.config.ReliableRabbitTemplate;
import com.zwh.rabbitmq.module.project.ProjectMqConstants;
import com.zwh.rabbitmq.module.project.dto.ProjectInfoDto;
import com.zwh.rabbitmq.module.project.mq.ProjectRabbitMqSender;

/**
 * @author zwh
 * @date 2021/12/9 17:12
 **/
@RestController
@RequestMapping("rabbitmq/")
public class SendRabbitMqController {
    /**
     * 自定义发送消息队列模板，object对象使用json序列化
     */
    @Autowired
    private ProjectRabbitMqSender sender;

    /**
     * 发送mq消息
     * @return
     */
    @GetMapping("sendDirect")
    public Object sendDirectQue() throws JsonProcessingException {
        String aa = "1234,6677";
        String bb = JSONObject.toJSONString(aa);
        String cc = new ObjectMapper().writeValueAsString(aa);
        sender.sendProjectAdd();
        return "ok!";
    }
}
